package cn.crawler.app.crown.modules.models;

import cn.crawler.framework.base.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;

import java.io.Serializable;

@EqualsAndHashCode(callSuper = true)
@Table("crown_equipment")
@TableIndexes({@Index(name = "index_no_unique",fields = {"no"})})
@Data
public class CrownEquipment extends BaseModel implements Serializable {
    private static final long serialVersionUID = 1L;

    @Column
    @Name
    @Comment("ID")
    @ColDefine(type = ColType.VARCHAR, width = 32)
    @PrevInsert(els = {@EL("uuid()")})
    private String id;

    /**
     * Id.createNo生成
     */
    @Column
    @Comment("设备号")
    @ColDefine(type = ColType.VARCHAR, width = 32)
    private String no;

    /**
     * DecipherUtil.generateKey生成
     */
    @Column
    @Comment("秘钥")
    @ColDefine(type = ColType.VARCHAR, width = 32)
    private String secret;

    @Column
    @Comment("名称")
    @ColDefine(type = ColType.VARCHAR, width = 32)
    private String name;

    @Column
    @Comment("备注")
    @ColDefine(type = ColType.VARCHAR, width = 32)
    private String remark;

    @Column
    @Comment("是否禁用")
    @Default("0")
    @ColDefine(type = ColType.BOOLEAN)
    private boolean disabled;

    @Column
    @Comment("创建时间")
    @PrevInsert(els = @EL("$me.now()"))
    private Long ctAt;

}
